<%@ page import="org.apache.shiro.SecurityUtils" %>
<%@ page contentType="text/html" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="UTF-8">
    <title>榆林市社会性别统计平台</title>
<%--    <link rel="shortcut icon" href="${contextPathLocal}/resources/images/favicon.ico" />--%>
    <c:set var="auth" value="${authentication}"/>
    <c:set var="contextPathLocal" value="${pageContext.request.contextPath}"/>
    <link href="${contextPathLocal}/resources/jquery.loadmask.css" rel="stylesheet" type="text/css"/>
    <link rel="stylesheet" type="text/css" href="${contextPathLocal}/resources/easyUI/themes/gray/easyui.css">
    <link rel="stylesheet" type="text/css" href="${contextPathLocal}/resources/easyUI/icon.css">
    <link rel="stylesheet" type="text/css" href="${contextPathLocal}/resources/style.css">
    <script type="text/javascript" src="${contextPathLocal}/resources/js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="${contextPathLocal}/resources/js/jquery.easyui.min.js"></script>
    <script type='text/javascript' src='${contextPathLocal}/resources/js/jquery.loadmask.js'></script>
    <script type='text/javascript' src='${contextPathLocal}/resources/js/util.js'></script>
</head>

<shiro:hasPermission name="menuManager:show">
<body class="easyui-layout" id="ibody">
<div data-options="region:'north',border:false" style="height:auto;overflow:hidden;">

    <div class="title_head">
        <div class="title_logoText">
            <img alt="榆林市社会性别统计平台" src="${contextPathLocal}/resources/icon/icon-del.png">
            <strong>榆林市社会性别统计平台</strong>
        </div>

        <div class="title_login">
             <a href="javaScript:void(0)" id='show'>
                 <img src="${contextPathLocal}/resources/images/menu.png">
                 <span style="color: #FFFFFF;">主菜单&nbsp;&nbsp;</span>
             </a>

             <a href="javaScript:void(0)" >
                <img src="${contextPathLocal}/resources/images/user.png">
                <span style="color: #FFFFFF;"><%=SecurityUtils.getSubject().getPrincipal()%></span>
             </a>

             <a href="/logout.do" >
                <img src="${contextPathLocal}/resources/images/exit.png">
                <span style="color: #FFFFFF;">退出&nbsp;&nbsp;</span>
             </a>

             <div class='title_headRi' id="menu_ul" style="display:none;">
                <ul>
                    <li class="xt_text" style="background-color: #ffffff;border: 1px solid #1196db;"><a href="${contextPathLocal}/home.do">报表数据</a></li>
                    <%-- <li class="xt_text" style="background-color: #ffffff;border: 1px solid #1196db;"><a href="${contextPathLocal}/society.do">社会报表</a></li> --%>
                    <li  class="current">系统管理</li>
                </ul>
             </div>
        </div>
	</div>
</div>

<div id="tt" data-options="region:'west',split:true,title:'菜单'" style="width:210px;">
    <div style="width: 100%; height: 100%">
        <ul style="margin: 0; padding: 0">

            <shiro:hasPermission name="area:show">
            <li class="systemBtn" id="li_mapbtn" style="height: 90px;">
					<span class="systemSpan">
						<a id="mapbtn" class="systemA btn_font" href="javascript:;"><b class="picBtn" style="background: url('${contextPathLocal}/resources/icon/diyu.png') no-repeat 0 0"></b><b class="icon2" id="icon_li_mapbtn"></b>地域管理</a>
					</span>
                <ul class="systemUl">
                    <li>
							<span class="systemUl_span">
								<a href="javascript:;" class="systemUl_a subBtn btn_font" url="${contextPathLocal}/area/view.do?page=view">地域管理</a>
							</span>
                    </li>
                </ul>
            </li>
	        </shiro:hasPermission>


            <shiro:hasPermission name="manager:view">
            <li class="systemBtn" id="li_alertbtn">
					<span class="systemSpan">
						<a id="alertbtn"  class="systemA btn_font" href="javascript:;">
						<b class="picBtn" style="background: url('${contextPathLocal}/resources/icon/configurationbtn.png') no-repeat 0 0"></b>
						<b class="icon" id="icon_li_alertbtn"></b>系统管理</a>
					</span>
                <ul class="systemUl">
                <shiro:hasPermission name="user:show">
                    <li>
                        <span class="systemUl_span">
                            <a class="systemUl_a subBtn" href="javascript:;"  url="${contextPathLocal}/manager/admin/permissionList.do?page=user">用户管理</a>
                        </span>
                    </li>
	            </shiro:hasPermission>
                <shiro:hasPermission name="role:show">
                    <li>
                        <span class="systemUl_span">
                            <a class="systemUl_a subBtn" href="javascript:;" url="${contextPathLocal}/manager/role/permissionList.do?page=role">角色管理</a>
                        </span>
                    </li>
	            </shiro:hasPermission>
                    <!--
                    <li>
                        <span class="systemUl_span">
                            <a class="systemUl_a subBtn btn_font" href="javascript:;" url="${contextPathLocal}/manager/permission/view.do?page=permission">权限管理</a>
                        </span>
                    </li>
                    -->
                    <shiro:hasPermission name="userTel:show">
                        <li>
                        <span class="systemUl_span">
                            <a class="systemUl_a subBtn" href="javascript:;" url="${contextPathLocal}/manager/admin/telView.do?page=tel">手机号匹配管理</a>
                        </span>
                        </li>
                    </shiro:hasPermission>
                </ul>
            </li>
	        </shiro:hasPermission>


            <shiro:hasPermission name="department:view">
            <li class="systemBtn" id="li_remainedbtn">
					<span class="systemSpan">
						<a id="remainedbtn"  class="systemA btn_font" href="javascript:;"><b class="picBtn" style="background: url('${contextPathLocal}/resources/icon/bumen.png') no-repeat 0 0"></b><b class="icon" id="icon_li_remainedbtn"></b>部门管理</a>
					</span>
                <ul class="systemUl">

                    <shiro:hasPermission name="departmentType:view">
                    <li>
                        <span class="systemUl_span">
                            <a class="systemUl_a subBtn btn_font" href="javascript:;" url="${contextPathLocal}/department/type/view.do?page=type">部门分类</a>
                        </span>
                    </li>
	                </shiro:hasPermission>
                    <shiro:hasPermission name="departAdmin:show">
                    <li>
                        <span class="systemUl_span">
                            <a class="systemUl_a subBtn btn_font" href="javascript:;" url="${contextPathLocal}/department/view.do?page=view">部门管理</a>
                        </span>
                    </li>
	                </shiro:hasPermission>
                </ul>
            </li>
	        </shiro:hasPermission>

        </ul>
    </div>
</div>

<div data-options="region:'center'" id="tabView">
    <div id="tabs" class="easyui-tabs" style="width: 100%;" data-options="border:false">
        <div id="center">
            <iframe name="mainIframe" id="mainIframe" frameborder="0" src="" style="width: 100%;"></iframe>
        </div>
    </div>
</div>
</body>
</shiro:hasPermission>

<script type="text/javascript">

	window.onresize = function () {
		$("#ibody").css({'minWidth':1024+'px'});
	}
	
    var userDefinedColumnFilterMap = new Object();
    var systemContextPath = '';
    function getSystemContextPath() {
        return systemContextPath;
    }

    (function () {
    	$("#ibody").css({'minWidth':1024+'px'});
    	
    	//鼠标悬浮显示报表 以及系统管理
    	$('.title_login>a[id]').hover(function(){
			 $('#menu_ul').slideDown(300);
		},function(){
			this.timer=setTimeout(function(){
					$('#menu_ul').hide();
			}, 50)
	    });
		
		$('#menu_ul').hover(function(){
			clearTimeout(document.getElementById('show').timer);
			 $('#menu_ul').slideDown(300);
		},function(){
			$('#menu_ul').hide();
	    })
    })();



    $(function () {
        var tabs = $('#tabs');
        var tabView = $('#tabView');
        var center = $('#center');
        var mainIframe = $('#mainIframe');
        mainIframe.css({height:tabView.height()-49});

        var centerPanel =  $("#ibody").layout("panel","center");
        centerPanel.panel({
            onResize:function(){
                mainIframe.css({height:tabView.height()-49});
            }
        })

        if ($('.title_headRi li.current').length == 0) {
            location.href = $('.title_headRi > ul > li > a:first').attr('href');
        }

        $(".subBtn").click(function (e) {
            unmask();
            var _t = $(e.target);
            var title = $(_t).text();
            var exists = $('#tabs').tabs('exists', title);
            closeTabs();
            var tab = $('#tabs').tabs('getSelected');
            $('#tabs').tabs('update', {
                tab: tab,
                options: {
                    title: $(_t).text()
                }
            });
            var url = $(_t).attr('url');
            if (url.indexOf("?") > 0) {
                url = url + "&" + Math.round(new Date().getTime() / 1000);
            } else {
                url = url + "?" + Math.round(new Date().getTime() / 1000);
            }
            $("#mainIframe").attr('src', url);
            //}

        });
        $(".subBtn:first").click();

        $("#tabs").tabs({
            onSelect: function (title) {
                var divs = $('#tabs .panel-body.panel-body-noheader.panel-body-noborder');
                if (divs && divs.length > 0) {
                    for (var i = 0; i < divs.length; i++) {
                        if ($(divs[i]).is(':visible')) {
                            var cdiv = divs[i];
                            var ht = $(cdiv).height();
                            $(cdiv).height(ht - 1);//重新设置一下div的高度
                            break;
                        }
                    }
                }
            }
        });

         $(".systemA").click(function () {
	            var id = "li_"+this.id;
	            for(var i=0; i<$(".systemBtn").length; i++){
	                if(id==$(".systemBtn")[i].id){
	                    document.getElementById("icon_"+$(".systemBtn")[i].id).className = "icon"
	                    $("#"+$(".systemBtn")[i].id).animate({height:"50px"});
	                }
	            }
            	animate(this.id,$(this).parents('.systemBtn').children(".systemUl").children('li').length*40+50);
        })

    });


    function animate(id,size) {
		    if($("#li_"+id).height()==size){
		        $("#li_"+id).animate({height:"50px"});
		        document.getElementById("icon_li_"+id).className = "icon"
		    }
		    else {
		        $("#li_"+id).animate({height:size+"px"});
		        document.getElementById("icon_li_"+id).className = "icon2"
		    }
	}


    function addTab(title, content, source) {
        var exists = $('#tabs').tabs('exists', title);
        if (exists) {
            $('#tabs').tabs('select', title);
        } else {
            $("#tabs").tabs('add', {
                id: source,
                title: title,
                content: content,
                closable: true
            });
        }
    }

    function updateTab(newTitle, content) {
        var currTab = $('#tabs').tabs('getSelected');
        $('#tabs').tabs('update', {tab: currTab, options: {title: newTitle, content: content}});
    }

    function closeTabs() {
        var tabs = $('#tabs').tabs("tabs");
        var length = tabs.length;
        for (var i = 1; i < length; i++) {
            var tab = tabs[1];
            var title = tab.panel('options').tab.text();
            $("#tabs").tabs("close", title);
        }
    }

    function mask() {
        $("#tabs").mask("Waiting...");
    }
    function unmask() {
        $("#tabs").unmask();
    }
</script>
</html>
